home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Controls.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  63.3 KB  |  1,581 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Controls.h
  3.  
  4.      Contains:    Control Manager interfaces
  5.  
  6.      Version:    Technology:    Mac OS 9
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1985-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CONTROLS__
  18. #define __CONTROLS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __QUICKDRAW__
  25.     #include <Quickdraw.h>
  26. #endif
  27.  
  28. #ifndef __MENUS__
  29.     #include <Menus.h>
  30. #endif
  31.  
  32. #ifndef __TEXTEDIT__
  33.     #include <TextEdit.h>
  34. #endif
  35.  
  36. #ifndef __DRAG__
  37.     #include <Drag.h>
  38. #endif
  39.  
  40. #ifndef __ICONS__
  41.     #include <Icons.h>
  42. #endif
  43.  
  44. #ifndef __COLLECTIONS__
  45.     #include <Collections.h>
  46. #endif
  47.  
  48. #ifndef __MACERRORS__
  49.     #include <MacErrors.h>
  50. #endif
  51.  
  52.  
  53.  
  54.  
  55.  
  56. #if PRAGMA_ONCE
  57. #pragma once
  58. #endif
  59.  
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63.  
  64. #if PRAGMA_IMPORT
  65. #pragma import on
  66. #endif
  67.  
  68. #if PRAGMA_STRUCT_ALIGN
  69.     #pragma options align=mac68k
  70. #elif PRAGMA_STRUCT_PACKPUSH
  71.     #pragma pack(push, 2)
  72. #elif PRAGMA_STRUCT_PACK
  73.     #pragma pack(2)
  74. #endif
  75.  
  76. /*------------------------------------------------------------------------------------------------------*/
  77. /*    o Resource Types                                                                                    */
  78. /*------------------------------------------------------------------------------------------------------*/
  79. enum {
  80.     kControlDefProcType            = FOUR_CHAR_CODE('CDEF'),
  81.     kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL'),
  82.     kControlColorTableResourceType = FOUR_CHAR_CODE('cctb'),
  83.     kControlDefProcResourceType    = FOUR_CHAR_CODE('CDEF')
  84. };
  85.  
  86. /*------------------------------------------------------------------------------------------------------*/
  87. /*    o Format of a 'CNTL' resource                                                                        */
  88. /*------------------------------------------------------------------------------------------------------*/
  89.  
  90. struct ControlTemplate {
  91.     Rect                             controlRect;
  92.     SInt16                             controlValue;
  93.     Boolean                         controlVisible;
  94.     UInt8                             fill;
  95.     SInt16                             controlMaximum;
  96.     SInt16                             controlMinimum;
  97.     SInt16                             controlDefProcID;
  98.     SInt32                             controlReference;
  99.     Str255                             controlTitle;
  100. };
  101. typedef struct ControlTemplate            ControlTemplate;
  102. typedef ControlTemplate *                ControlTemplatePtr;
  103. typedef ControlTemplatePtr *            ControlTemplateHandle;
  104.  
  105.  
  106. #if !TARGET_OS_MAC
  107. /*
  108.   ---------------------------------------------------------------------------------------------------------
  109.    o NON-MAC COMPATIBILITY CODES (QuickTime 3.0)
  110.   ---------------------------------------------------------------------------------------------------------
  111. */
  112.  
  113. typedef UInt32                             ControlNotification;
  114. enum {
  115.     controlNotifyNothing        = FOUR_CHAR_CODE('nada'),        /* No (null) notification*/
  116.     controlNotifyClick            = FOUR_CHAR_CODE('clik'),        /* Control was clicked*/
  117.     controlNotifyFocus            = FOUR_CHAR_CODE('focu'),        /* Control got keyboard focus*/
  118.     controlNotifyKey            = FOUR_CHAR_CODE('key ')        /* Control got a keypress*/
  119. };
  120.  
  121. typedef UInt32                             ControlCapabilities;
  122. enum {
  123.     kControlCanAutoInvalidate    = 1L << 0                        /* Control component automatically invalidates areas left behind after hide/move operation.*/
  124. };
  125.  
  126. /* procID's for our added "controls"*/
  127. enum {
  128.     staticTextProc                = 256,                            /* static text*/
  129.     editTextProc                = 272,                            /* editable text*/
  130.     iconProc                    = 288,                            /* icon*/
  131.     userItemProc                = 304,                            /* user drawn item*/
  132.     pictItemProc                = 320                            /* pict*/
  133. };
  134.  
  135. #endif  /* !TARGET_OS_MAC */
  136.  
  137. /*------------------------------------------------------------------------------------------------------*/
  138. /*    o ControlRef                                                                                        */
  139. /*------------------------------------------------------------------------------------------------------*/
  140. #if !OPAQUE_TOOLBOX_STRUCTS
  141. typedef struct ControlRecord             ControlRecord;
  142. typedef ControlRecord *                    ControlPtr;
  143. typedef ControlPtr *                    ControlRef;
  144. #else
  145. typedef struct OpaqueControlRef*         ControlRef;
  146. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  147.  
  148. /* ControlHandle is obsolete. Use ControlRef.*/
  149. typedef ControlRef                         ControlHandle;
  150. typedef SInt16                             ControlPartCode;
  151. /*------------------------------------------------------------------------------------------------------*/
  152. /* o Control ActionProcPtr                                                                                */
  153. /*------------------------------------------------------------------------------------------------------*/
  154. typedef CALLBACK_API( void , ControlActionProcPtr )(ControlRef theControl, ControlPartCode partCode);
  155. typedef STACK_UPP_TYPE(ControlActionProcPtr)                     ControlActionUPP;
  156. /*------------------------------------------------------------------------------------------------------*/
  157. /*    o ControlRecord                                                                                        */
  158. /*------------------------------------------------------------------------------------------------------*/
  159. #if !OPAQUE_TOOLBOX_STRUCTS
  160.  
  161. struct ControlRecord {
  162.     ControlRef                         nextControl;
  163.     WindowPtr                         contrlOwner;
  164.     Rect                             contrlRect;
  165.     UInt8                             contrlVis;
  166.     UInt8                             contrlHilite;
  167.     SInt16                             contrlValue;
  168.     SInt16                             contrlMin;
  169.     SInt16                             contrlMax;
  170.     Handle                             contrlDefProc;
  171.     Handle                             contrlData;
  172.     ControlActionUPP                 contrlAction;
  173.     SInt32                             contrlRfCon;
  174.     Str255                             contrlTitle;
  175. };
  176.  
  177. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  178.  
  179. /*------------------------------------------------------------------------------------------------------*/
  180. /* o Control ActionProcPtr : Epilogue                                                                    */
  181. /*------------------------------------------------------------------------------------------------------*/
  182. #if OPAQUE_UPP_TYPES
  183.     EXTERN_API(ControlActionUPP)
  184.     NewControlActionUPP               (ControlActionProcPtr    userRoutine);
  185.  
  186.     EXTERN_API(void)
  187.     DisposeControlActionUPP           (ControlActionUPP        userUPP);
  188.  
  189.     EXTERN_API(void)
  190.     InvokeControlActionUPP           (ControlRef                theControl,
  191.                                     ControlPartCode            partCode,
  192.                                     ControlActionUPP        userUPP);
  193.  
  194. #else
  195.     enum { uppControlActionProcInfo = 0x000002C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes) */
  196.     #define NewControlActionUPP(userRoutine)                         (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture())
  197.     #define DisposeControlActionUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  198.     #define InvokeControlActionUPP(theControl, partCode, userUPP)     CALL_TWO_PARAMETER_UPP((userUPP), uppControlActionProcInfo, (theControl), (partCode))
  199. #endif
  200. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  201. #define NewControlActionProc(userRoutine)                         NewControlActionUPP(userRoutine)
  202. #define CallControlActionProc(userRoutine, theControl, partCode) InvokeControlActionUPP(theControl, partCode, userRoutine)
  203. /*------------------------------------------------------------------------------------------------------*/
  204. /*    o Control Color Table                                                                                */
  205. /*------------------------------------------------------------------------------------------------------*/
  206. enum {
  207.     cFrameColor                    = 0,
  208.     cBodyColor                    = 1,
  209.     cTextColor                    = 2,
  210.     cThumbColor                    = 3,
  211.     kNumberCtlCTabEntries        = 4
  212. };
  213.  
  214.  
  215. struct CtlCTab {
  216.     SInt32                             ccSeed;
  217.     SInt16                             ccRider;
  218.     SInt16                             ctSize;
  219.     ColorSpec                         ctTable[4];
  220. };
  221. typedef struct CtlCTab                    CtlCTab;
  222.  
  223. typedef CtlCTab *                        CCTabPtr;
  224. typedef CCTabPtr *                        CCTabHandle;
  225. /*------------------------------------------------------------------------------------------------------*/
  226. /*    o Auxiliary Control Record                                                                            */
  227. /*------------------------------------------------------------------------------------------------------*/
  228. #if !OPAQUE_TOOLBOX_STRUCTS
  229.  
  230. struct AuxCtlRec {
  231.     Handle                             acNext;
  232.     ControlRef                         acOwner;
  233.     CCTabHandle                     acCTable;
  234.     SInt16                             acFlags;
  235.     SInt32                             acReserved;
  236.     SInt32                             acRefCon;
  237. };
  238. typedef struct AuxCtlRec                AuxCtlRec;
  239.  
  240. typedef AuxCtlRec *                        AuxCtlPtr;
  241. typedef AuxCtlPtr *                        AuxCtlHandle;
  242. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  243.  
  244. /*--------------------------------------------------------------------------------------*/
  245. /*    o Control Variants                                                                    */
  246. /*--------------------------------------------------------------------------------------*/
  247. typedef SInt16                             ControlVariant;
  248. enum {
  249.     kControlNoVariant            = 0,                            /* No variant*/
  250.     kControlUsesOwningWindowsFontVariant = 1 << 3                /* Control uses owning windows font to display text*/
  251. };
  252.  
  253.  
  254. /*--------------------------------------------------------------------------------------*/
  255. /*    o Control Part Codes                                                                */
  256. /*--------------------------------------------------------------------------------------*/
  257. /* Basic part codes */
  258. enum {
  259.     kControlNoPart                = 0,
  260.     kControlIndicatorPart        = 129,
  261.     kControlDisabledPart        = 254,
  262.     kControlInactivePart        = 255
  263. };
  264.  
  265. /* Use this constant in Get/SetControlData when the data referred to is not            */
  266. /* specific to a part, but rather the entire control, e.g. the list handle of a     */
  267. /* list box control.                                                                */
  268. enum {
  269.     kControlEntireControl        = 0
  270. };
  271.  
  272. /*     Meta-Parts                                                                            */
  273. /*                                                                                        */
  274. /*     If you haven't guessed from looking at other toolbox headers. We like the word         */
  275. /*    'meta'. It's cool. So here's one more for you. A meta-part is a part used in a call    */
  276. /*     to the GetControlRegion API. These parts are parts that might be defined by a        */
  277. /*    control, but should not be returned from calls like TestControl, et al. They define    */
  278. /*     a region of a control, presently the structure and the content region. The content    */
  279. /*     region is only defined by controls that can embed other controls. It is the area    */
  280. /*     that embedded content can live.                                                        */
  281. /*                                                                                        */
  282. /*    Along with these parts, you can also pass in normal part codes to get the regions    */
  283. /*     of the parts. Not all controls fully support this at the time this was written.        */
  284. enum {
  285.     kControlStructureMetaPart    = -1,
  286.     kControlContentMetaPart        = -2
  287. };
  288.  
  289. /* focusing part codes */
  290. enum {
  291.     kControlFocusNoPart            = 0,                            /* tells control to clear its focus*/
  292.     kControlFocusNextPart        = -1,                            /* tells control to focus on the next part*/
  293.     kControlFocusPrevPart        = -2                            /* tells control to focus on the previous part*/
  294. };
  295.  
  296. typedef SInt16                             ControlFocusPart;
  297. /*------------------------------------------------------------------------------------------------------*/
  298. /*    o Control Collection Tags                                                                            */
  299. /*------------------------------------------------------------------------------------------------------*/
  300. /*    These are standard tags that you will find in a flattened Control's Collection.                        */
  301. /*                                                                                                        */
  302. /*    All tags at ID zero in a flattened Control's Collection is reserved for Control Manager use.        */
  303. /*    Custom control definitions should use other IDs.                                                    */
  304. /*                                                                                                        */
  305. /*    Most of these tags are interpreted when you call CreateCustomControl; the Control Manager will        */
  306. /*    put value in the right place before calling the Control Definition with the initialization message. */
  307. /*    Other tags are only interpreted when calling UnflattenControl.                                        */
  308. enum {
  309.     kControlCollectionTagBounds    = FOUR_CHAR_CODE('boun'),        /* Rect - the bounding rectangle*/
  310.     kControlCollectionTagValue    = FOUR_CHAR_CODE('valu'),        /* SInt32 - the value*/
  311.     kControlCollectionTagMinimum = FOUR_CHAR_CODE('min '),        /* SInt32 - the minimum*/
  312.     kControlCollectionTagMaximum = FOUR_CHAR_CODE('max '),        /* SInt32 - the maximum*/
  313.     kControlCollectionTagViewSize = FOUR_CHAR_CODE('view'),        /* SInt32 - the view size*/
  314.     kControlCollectionTagVisibility = FOUR_CHAR_CODE('visi'),    /* Boolean - the visible state*/
  315.     kControlCollectionTagRefCon    = FOUR_CHAR_CODE('refc'),        /* SInt32 - the refCon*/
  316.     kControlCollectionTagTitle    = FOUR_CHAR_CODE('titl')        /* arbitrarily sized character array - the title*/
  317. };
  318.  
  319. /*    The following are additional tags which are only interpreted by UnflattenControl. */
  320. enum {
  321.     kControlCollectionTagSubControls = FOUR_CHAR_CODE('subc')    /* data for all of a control's subcontrols*/
  322. };
  323.  
  324.  
  325. /*------------------------------------------------------------------------------------------------------*/
  326. /*    o Control Image Content                                                                                */
  327. /*------------------------------------------------------------------------------------------------------*/
  328. enum {
  329.     kControlContentTextOnly        = 0,
  330.     kControlNoContent            = 0,
  331.     kControlContentIconSuiteRes    = 1,
  332.     kControlContentCIconRes        = 2,
  333.     kControlContentPictRes        = 3,
  334.     kControlContentICONRes        = 4,
  335.     kControlContentIconSuiteHandle = 129,
  336.     kControlContentCIconHandle    = 130,
  337.     kControlContentPictHandle    = 131,
  338.     kControlContentIconRef        = 132,
  339.     kControlContentICON            = 133
  340. };
  341.  
  342. typedef SInt16                             ControlContentType;
  343.  
  344. struct ControlButtonContentInfo {
  345.     ControlContentType                 contentType;
  346.     union {
  347.         SInt16                             resID;
  348.         CIconHandle                     cIconHandle;
  349.         Handle                             iconSuite;
  350.         IconRef                         iconRef;
  351.         PicHandle                         picture;
  352.         Handle                             ICONHandle;
  353.     }                                 u;
  354. };
  355. typedef struct ControlButtonContentInfo    ControlButtonContentInfo;
  356. typedef ControlButtonContentInfo *        ControlButtonContentInfoPtr;
  357.  
  358. typedef ControlButtonContentInfo         ControlImageContentInfo;
  359. typedef ControlButtonContentInfo *        ControlImageContentInfoPtr;
  360. /*------------------------------------------------------------------------------------------------------*/
  361. /*    o Control Key Script Behavior                                                                        */
  362. /*------------------------------------------------------------------------------------------------------*/
  363. enum {
  364.     kControlKeyScriptBehaviorAllowAnyScript = FOUR_CHAR_CODE('any '), /* leaves the current keyboard alone and allows user to change the keyboard.*/
  365.     kControlKeyScriptBehaviorPrefersRoman = FOUR_CHAR_CODE('prmn'), /* switches the keyboard to roman, but allows them to change it as desired.*/
  366.     kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') /* switches the keyboard to roman and prevents the user from changing it.*/
  367. };
  368.  
  369. typedef UInt32                             ControlKeyScriptBehavior;
  370. /*------------------------------------------------------------------------------------------------------*/
  371. /*    o Control Font Style                                                                                */
  372. /*------------------------------------------------------------------------------------------------------*/
  373. /*     SPECIAL FONT USAGE NOTES: You can specify the font to use for many control types.
  374.     The constants below are meta-font numbers which you can use to set a particular
  375.     control's font usage. There are essentially two modes you can use: 1) default,
  376.     which is essentially the same as it always has been, i.e. it uses the system font, unless
  377.     directed to use the window font via a control variant. 2) you can specify to use
  378.     the big or small system font in a generic manner. The Big system font is the font
  379.     used in menus, etc. Chicago has filled that role for some time now. Small system
  380.     font is currently Geneva 10. The meta-font number implies the size and style.
  381.  
  382.     NOTE:        Not all font attributes are used by all controls. Most, in fact, ignore
  383.                 the fore and back color (Static Text is the only one that does, for
  384.                 backwards compatibility). Also size, face, and addFontSize are ignored
  385.                 when using the meta-font numbering.
  386. */
  387. /* Meta-font numbering - see note above */
  388. enum {
  389.     kControlFontBigSystemFont    = -1,                            /* force to big system font*/
  390.     kControlFontSmallSystemFont    = -2,                            /* force to small system font*/
  391.     kControlFontSmallBoldSystemFont = -3,                        /* force to small bold system font*/
  392.     kControlFontViewSystemFont    = -4                            /* force to views system font (DataBrowser control only)*/
  393. };
  394.  
  395. /* Add these masks together to set the flags field of a ControlFontStyleRec    */
  396. /* They specify which fields to apply to the text. It is important to make    */
  397. /* sure that you specify only the fields that you wish to set.                */
  398. enum {
  399.     kControlUseFontMask            = 0x0001,
  400.     kControlUseFaceMask            = 0x0002,
  401.     kControlUseSizeMask            = 0x0004,
  402.     kControlUseForeColorMask    = 0x0008,
  403.     kControlUseBackColorMask    = 0x0010,
  404.     kControlUseModeMask            = 0x0020,
  405.     kControlUseJustMask            = 0x0040,
  406.     kControlUseAllMask            = 0x00FF,
  407.     kControlAddFontSizeMask        = 0x0100
  408. };
  409.  
  410. /* AddToMetaFont indicates that we want to start with a standard system        */
  411. /* font, but then we'd like to add the other attributes. Normally, the meta    */
  412. /* font ignores all other flags                                             */
  413. enum {
  414.     kControlAddToMetaFontMask    = 0x0200                        /* Available in Appearance 1.1 or later*/
  415. };
  416.  
  417.  
  418. struct ControlFontStyleRec {
  419.     SInt16                             flags;
  420.     SInt16                             font;
  421.     SInt16                             size;
  422.     SInt16                             style;
  423.     SInt16                             mode;
  424.     SInt16                             just;
  425.     RGBColor                         foreColor;
  426.     RGBColor                         backColor;
  427. };
  428. typedef struct ControlFontStyleRec        ControlFontStyleRec;
  429.  
  430. typedef ControlFontStyleRec *            ControlFontStylePtr;
  431. /*------------------------------------------------------------------------------------------------------*/
  432. /*    o Click Activation Results                                                                            */
  433. /*------------------------------------------------------------------------------------------------------*/
  434. /*    These are for use with GetControlClickActivation. The enumerated values should be pretty            */
  435. /*    self-explanatory, but just in case:                                                                    */
  436. /*    o Activate/DoNotActivate indicates whether or not to change the owning window's z-ordering before    */
  437. /*        processing the click. If activation is requested, you may also want to immediately redraw the    */
  438. /*        newly exposed portion of the window.                                                            */
  439. /*    o Ignore/Handle Click indicates whether or not to call an appropriate click handling API (like        */
  440. /*        HandleControlClick) in respose to the event.                                                    */
  441. enum {
  442.     kDoNotActivateAndIgnoreClick = 0,                            /* probably never used. here for completeness.*/
  443.     kDoNotActivateAndHandleClick = 1,                            /* let the control handle the click while the window is still in the background.*/
  444.     kActivateAndIgnoreClick        = 2,                            /* control doesn't want to respond directly to the click, but window should still be brought forward.*/
  445.     kActivateAndHandleClick        = 3                                /* control wants to respond to the click, but only after the window has been activated.*/
  446. };
  447.  
  448. typedef UInt32                             ClickActivationResult;
  449. /*------------------------------------------------------------------------------------------------------*/
  450. /*    o Common data tags for Get/SetControlData                                                            */
  451. /*------------------------------------------------------------------------------------------------------*/
  452. enum {
  453.     kControlFontStyleTag        = FOUR_CHAR_CODE('font'),
  454.     kControlKeyFilterTag        = FOUR_CHAR_CODE('fltr')
  455. };
  456.  
  457.  
  458. /*------------------------------------------------------------------------------------------------------*/
  459. /*    o Control Feature Bits                                                                                */
  460. /*------------------------------------------------------------------------------------------------------*/
  461. enum {
  462.                                                                 /* Control feature bits - returned by GetControlFeatures */
  463.     kControlSupportsGhosting    = 1 << 0,
  464.     kControlSupportsEmbedding    = 1 << 1,
  465.     kControlSupportsFocus        = 1 << 2,
  466.     kControlWantsIdle            = 1 << 3,
  467.     kControlWantsActivate        = 1 << 4,
  468.     kControlHandlesTracking        = 1 << 5,
  469.     kControlSupportsDataAccess    = 1 << 6,
  470.     kControlHasSpecialBackground = 1 << 7,
  471.     kControlGetsFocusOnClick    = 1 << 8,
  472.     kControlSupportsCalcBestRect = 1 << 9,
  473.     kControlSupportsLiveFeedback = 1 << 10,
  474.     kControlHasRadioBehavior    = 1 << 11,                        /* Available in Appearance 1.0.1 or later*/
  475.     kControlSupportsDragAndDrop    = 1 << 12,                        /* Available in Carbon*/
  476.     kControlAutoToggles            = 1 << 14,                        /* Available in Appearance 1.1 or later*/
  477.     kControlSupportsGetRegion    = 1 << 17,                        /* Available in Appearance 1.1 or later*/
  478.     kControlSupportsFlattening    = 1 << 19,                        /* Available in Carbon*/
  479.     kControlSupportsSetCursor    = 1 << 20,                        /* Available in Carbon*/
  480.     kControlSupportsContextualMenus = 1 << 21,                    /* Available in Carbon*/
  481.     kControlSupportsClickActivation = 1 << 22                    /* Available in Carbon*/
  482. };
  483.  
  484. /*------------------------------------------------------------------------------------------------------*/
  485. /*    o Control Messages                                                                                    */
  486. /*------------------------------------------------------------------------------------------------------*/
  487. enum {
  488.     drawCntl                    = 0,
  489.     testCntl                    = 1,
  490.     calcCRgns                    = 2,
  491.     initCntl                    = 3,
  492.     dispCntl                    = 4,
  493.     posCntl                        = 5,
  494.     thumbCntl                    = 6,
  495.     dragCntl                    = 7,
  496.     autoTrack                    = 8,
  497.     calcCntlRgn                    = 10,
  498.     calcThumbRgn                = 11,
  499.     drawThumbOutline            = 12,
  500.     kControlMsgDrawGhost        = 13,
  501.     kControlMsgCalcBestRect        = 14,                            /* Calculate best fitting rectangle for control*/
  502.     kControlMsgHandleTracking    = 15,
  503.     kControlMsgFocus            = 16,                            /* param indicates action.*/
  504.     kControlMsgKeyDown            = 17,
  505.     kControlMsgIdle                = 18,
  506.     kControlMsgGetFeatures        = 19,
  507.     kControlMsgSetData            = 20,
  508.     kControlMsgGetData            = 21,
  509.     kControlMsgActivate            = 22,
  510.     kControlMsgSetUpBackground    = 23,
  511.     kControlMsgCalcValueFromPos    = 26,
  512.     kControlMsgTestNewMsgSupport = 27,                            /* See if this control supports new messaging*/
  513.     kControlMsgSubValueChanged    = 25,                            /* Available in Appearance 1.0.1 or later*/
  514.     kControlMsgSubControlAdded    = 28,                            /* Available in Appearance 1.0.1 or later*/
  515.     kControlMsgSubControlRemoved = 29,                            /* Available in Appearance 1.0.1 or later*/
  516.     kControlMsgApplyTextColor    = 30,                            /* Available in Appearance 1.1 or later*/
  517.     kControlMsgGetRegion        = 31,                            /* Available in Appearance 1.1 or later*/
  518.     kControlMsgFlatten            = 32,                            /* Available in Carbon. Param is Collection.*/
  519.     kControlMsgSetCursor        = 33,                            /* Available in Carbon. Param is ControlSetCursorRec*/
  520.     kControlMsgDragEnter        = 38,                            /* Available in Carbon. Param is DragRef, result is boolean indicating acceptibility of drag.*/
  521.     kControlMsgDragLeave        = 39,                            /* Available in Carbon. As above.*/
  522.     kControlMsgDragWithin        = 40,                            /* Available in Carbon. As above.*/
  523.     kControlMsgDragReceive        = 41,                            /* Available in Carbon. Param is DragRef, result is OSStatus indicating success/failure.*/
  524.     kControlMsgDisplayDebugInfo    = 46,                            /* Available in Carbon on X.*/
  525.     kControlMsgContextualMenuClick = 47,                        /* Available in Carbon. Param is ControlContextualMenuClickRec*/
  526.     kControlMsgGetClickActivation = 48                            /* Available in Carbon. Param is ControlClickActivationRec*/
  527. };
  528.  
  529. typedef SInt16                             ControlDefProcMessage;
  530. /*--------------------------------------------------------------------------------------*/
  531. /*    o Constants for drawCntl message (passed in param)                                    */
  532. /*--------------------------------------------------------------------------------------*/
  533. enum {
  534.     kDrawControlEntireControl    = 0,
  535.     kDrawControlIndicatorOnly    = 129
  536. };
  537.  
  538. /*--------------------------------------------------------------------------------------*/
  539. /*    o Constants for dragCntl message (passed in param)                                    */
  540. /*--------------------------------------------------------------------------------------*/
  541. enum {
  542.     kDragControlEntireControl    = 0,
  543.     kDragControlIndicator        = 1
  544. };
  545.  
  546. /*--------------------------------------------------------------------------------------*/
  547. /*    o Drag Constraint Structure for thumbCntl message (passed in param)                    */
  548. /*--------------------------------------------------------------------------------------*/
  549.  
  550. struct IndicatorDragConstraint {
  551.     Rect                             limitRect;
  552.     Rect                             slopRect;
  553.     DragConstraint                     axis;
  554. };
  555. typedef struct IndicatorDragConstraint    IndicatorDragConstraint;
  556. typedef IndicatorDragConstraint *        IndicatorDragConstraintPtr;
  557. /*--------------------------------------------------------------------------------------*/
  558. /*     CDEF should return as result of kControlMsgTestNewMsgSupport                        */
  559. /*--------------------------------------------------------------------------------------*/
  560. enum {
  561.     kControlSupportsNewMessages    = FOUR_CHAR_CODE(' ok ')
  562. };
  563.  
  564. /*--------------------------------------------------------------------------------------*/
  565. /*     This structure is passed into a CDEF when called with the kControlMsgHandleTracking    */
  566. /*    message                                                                             */
  567. /*--------------------------------------------------------------------------------------*/
  568.  
  569. struct ControlTrackingRec {
  570.     Point                             startPt;
  571.     EventModifiers                     modifiers;
  572.     ControlActionUPP                 action;
  573. };
  574. typedef struct ControlTrackingRec        ControlTrackingRec;
  575.  
  576. typedef ControlTrackingRec *            ControlTrackingPtr;
  577. /*--------------------------------------------------------------------------------------*/
  578. /* This structure is passed into a CDEF when called with the kControlMsgKeyDown message */
  579. /*--------------------------------------------------------------------------------------*/
  580.  
  581. struct ControlKeyDownRec {
  582.     EventModifiers                     modifiers;
  583.     SInt16                             keyCode;
  584.     SInt16                             charCode;
  585. };
  586. typedef struct ControlKeyDownRec        ControlKeyDownRec;
  587.  
  588. typedef ControlKeyDownRec *                ControlKeyDownPtr;
  589. /*--------------------------------------------------------------------------------------*/
  590. /* This structure is passed into a CDEF when called with the kControlMsgGetData or        */
  591. /* kControlMsgSetData message                                                             */
  592. /*--------------------------------------------------------------------------------------*/
  593.  
  594. struct ControlDataAccessRec {
  595.     ResType                         tag;
  596.     ResType                         part;
  597.     Size                             size;
  598.     Ptr                             dataPtr;
  599. };
  600. typedef struct ControlDataAccessRec        ControlDataAccessRec;
  601.  
  602. typedef ControlDataAccessRec *            ControlDataAccessPtr;
  603. /*--------------------------------------------------------------------------------------*/
  604. /* This structure is passed into a CDEF when called with the kControlCalcBestRect msg     */
  605. /*--------------------------------------------------------------------------------------*/
  606.  
  607. struct ControlCalcSizeRec {
  608.     SInt16                             height;
  609.     SInt16                             width;
  610.     SInt16                             baseLine;
  611. };
  612. typedef struct ControlCalcSizeRec        ControlCalcSizeRec;
  613.  
  614. typedef ControlCalcSizeRec *            ControlCalcSizePtr;
  615. /*--------------------------------------------------------------------------------------*/
  616. /* This structure is passed into a CDEF when called with the kControlMsgSetUpBackground */
  617. /* message is sent                                                                        */
  618. /*--------------------------------------------------------------------------------------*/
  619.  
  620. struct ControlBackgroundRec {
  621.     SInt16                             depth;
  622.     Boolean                         colorDevice;
  623. };
  624. typedef struct ControlBackgroundRec        ControlBackgroundRec;
  625.  
  626. typedef ControlBackgroundRec *            ControlBackgroundPtr;
  627. /*--------------------------------------------------------------------------------------*/
  628. /* This structure is passed into a CDEF when called with the kControlMsgApplyTextColor    */
  629. /* message is sent                                                                        */
  630. /*--------------------------------------------------------------------------------------*/
  631.  
  632. struct ControlApplyTextColorRec {
  633.     SInt16                             depth;
  634.     Boolean                         colorDevice;
  635.     Boolean                         active;
  636. };
  637. typedef struct ControlApplyTextColorRec    ControlApplyTextColorRec;
  638.  
  639. typedef ControlApplyTextColorRec *        ControlApplyTextColorPtr;
  640. /*--------------------------------------------------------------------------------------*/
  641. /* This structure is passed into a CDEF when called with the kControlMsgGetRegion        */
  642. /* message is sent                                                                        */
  643. /*--------------------------------------------------------------------------------------*/
  644.  
  645. struct ControlGetRegionRec {
  646.     RgnHandle                         region;
  647.     ControlPartCode                 part;
  648. };
  649. typedef struct ControlGetRegionRec        ControlGetRegionRec;
  650.  
  651. typedef ControlGetRegionRec *            ControlGetRegionPtr;
  652. /*--------------------------------------------------------------------------------------*/
  653. /* This structure is passed into a CDEF when the kControlMsgSetCursor message is sent    */
  654. /* Only sent on Carbon                                                                    */
  655. /*--------------------------------------------------------------------------------------*/
  656.  
  657. struct ControlSetCursorRec {
  658.     Point                             localPoint;
  659.     EventModifiers                     modifiers;
  660.     Boolean                         cursorWasSet;                /* your CDEF must set this to true if you set the cursor, or false otherwise*/
  661. };
  662. typedef struct ControlSetCursorRec        ControlSetCursorRec;
  663.  
  664. typedef ControlSetCursorRec *            ControlSetCursorPtr;
  665. /*--------------------------------------------------------------------------------------*/
  666. /* This structure is passed into a CDEF when the kControlMsgContextualMenuClick message */
  667. /* is sent                                                                                */
  668. /* Only sent on Carbon                                                                    */
  669. /*--------------------------------------------------------------------------------------*/
  670.  
  671. struct ControlContextualMenuClickRec {
  672.     Point                             localPoint;
  673.     Boolean                         menuDisplayed;                /* your CDEF must set this to true if you displayed a menu, or false otherwise*/
  674. };
  675. typedef struct ControlContextualMenuClickRec ControlContextualMenuClickRec;
  676.  
  677. typedef ControlContextualMenuClickRec *    ControlContextualMenuClickPtr;
  678. /*--------------------------------------------------------------------------------------*/
  679. /* This structure is passed into a CDEF when the kControlMsgGetClickActivation message    */
  680. /* is sent                                                                                */
  681. /* Only sent on Carbon                                                                    */
  682. /*--------------------------------------------------------------------------------------*/
  683.  
  684. struct ControlClickActivationRec {
  685.     Point                             localPoint;
  686.     EventModifiers                     modifiers;
  687.     ClickActivationResult             result;                        /* your CDEF must pass the desired result back*/
  688. };
  689. typedef struct ControlClickActivationRec ControlClickActivationRec;
  690.  
  691. typedef ControlClickActivationRec *        ControlClickActivationPtr;
  692. /*--------------------------------------------------------------------------------------*/
  693. /*    o 'CDEF' entrypoint                                                                    */
  694. /*--------------------------------------------------------------------------------------*/
  695. typedef CALLBACK_API( SInt32 , ControlDefProcPtr )(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param);
  696. typedef STACK_UPP_TYPE(ControlDefProcPtr)                         ControlDefUPP;
  697. #if OPAQUE_UPP_TYPES
  698.     EXTERN_API(ControlDefUPP)
  699.     NewControlDefUPP               (ControlDefProcPtr        userRoutine);
  700.  
  701.     EXTERN_API(void)
  702.     DisposeControlDefUPP           (ControlDefUPP            userUPP);
  703.  
  704.     EXTERN_API(SInt32)
  705.     InvokeControlDefUPP               (SInt16                    varCode,
  706.                                     ControlRef                theControl,
  707.                                     ControlDefProcMessage    message,
  708.                                     SInt32                    param,
  709.                                     ControlDefUPP            userUPP);
  710.  
  711. #else
  712.     enum { uppControlDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  713.     #define NewControlDefUPP(userRoutine)                             (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture())
  714.     #define DisposeControlDefUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  715.     #define InvokeControlDefUPP(varCode, theControl, message, param, userUPP)  (SInt32)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlDefProcInfo, (varCode), (theControl), (message), (param))
  716. #endif
  717. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  718. #define NewControlDefProc(userRoutine)                             NewControlDefUPP(userRoutine)
  719. #define CallControlDefProc(userRoutine, varCode, theControl, message, param) InvokeControlDefUPP(varCode, theControl, message, param, userRoutine)
  720. /*--------------------------------------------------------------------------------------*/
  721. /*    Control Key Filter                                                                    */
  722. /*--------------------------------------------------------------------------------------*/
  723. /* Certain controls can have a keyfilter attached to them.                                */
  724. /* Definition of a key filter for intercepting and possibly changing keystrokes            */
  725. /* which are destined for a control.                                                    */
  726. /* Key Filter Result Codes                                                             */
  727. /* The filter proc should return one of the two constants below. If                    */
  728. /* kKeyFilterBlockKey is returned, the key is blocked and never makes it to the        */
  729. /* control. If kKeyFilterPassKey is returned, the control receives the keystroke.    */
  730. enum {
  731.     kControlKeyFilterBlockKey    = 0,
  732.     kControlKeyFilterPassKey    = 1
  733. };
  734.  
  735. typedef SInt16                             ControlKeyFilterResult;
  736. typedef CALLBACK_API( ControlKeyFilterResult , ControlKeyFilterProcPtr )(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode, EventModifiers *modifiers);
  737. typedef STACK_UPP_TYPE(ControlKeyFilterProcPtr)                 ControlKeyFilterUPP;
  738. #if OPAQUE_UPP_TYPES
  739.     EXTERN_API(ControlKeyFilterUPP)
  740.     NewControlKeyFilterUPP           (ControlKeyFilterProcPtr    userRoutine);
  741.  
  742.     EXTERN_API(void)
  743.     DisposeControlKeyFilterUPP       (ControlKeyFilterUPP        userUPP);
  744.  
  745.     EXTERN_API(ControlKeyFilterResult)
  746.     InvokeControlKeyFilterUPP       (ControlRef                theControl,
  747.                                     SInt16 *                keyCode,
  748.                                     SInt16 *                charCode,
  749.                                     EventModifiers *        modifiers,
  750.                                     ControlKeyFilterUPP        userUPP);
  751.  
  752. #else
  753.     enum { uppControlKeyFilterProcInfo = 0x00003FE0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  754.     #define NewControlKeyFilterUPP(userRoutine)                     (ControlKeyFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlKeyFilterProcInfo, GetCurrentArchitecture())
  755.     #define DisposeControlKeyFilterUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  756.     #define InvokeControlKeyFilterUPP(theControl, keyCode, charCode, modifiers, userUPP)  (ControlKeyFilterResult)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlKeyFilterProcInfo, (theControl), (keyCode), (charCode), (modifiers))
  757. #endif
  758. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  759. #define NewControlKeyFilterProc(userRoutine)                     NewControlKeyFilterUPP(userRoutine)
  760. #define CallControlKeyFilterProc(userRoutine, theControl, keyCode, charCode, modifiers) InvokeControlKeyFilterUPP(theControl, keyCode, charCode, modifiers, userRoutine)
  761.  
  762. /*--------------------------------------------------------------------------------------*/
  763. /*     o DragGrayRgn Constatns                                                                */
  764. /*                                                                                        */
  765. /*   For DragGrayRgnUPP used in TrackControl()                                             */
  766. /*--------------------------------------------------------------------------------------*/
  767. enum {
  768.     noConstraint                = kNoConstraint,
  769.     hAxisOnly                    = 1,
  770.     vAxisOnly                    = 2
  771. };
  772.  
  773. /*--------------------------------------------------------------------------------------*/
  774. /*    o Control Creation/Deletion/Persistence                                                */
  775. /*--------------------------------------------------------------------------------------*/
  776. /*    CreateCustomControl is only available as part of Carbon                                */
  777. enum {
  778.     kControlDefProcPtr            = 0                                /* raw proc-ptr based access*/
  779. };
  780.  
  781. typedef UInt32                             ControlDefType;
  782.  
  783. struct ControlDefSpec {
  784.     ControlDefType                     defType;
  785.     union {
  786.         ControlDefUPP                     defProc;
  787.     }                                 u;
  788. };
  789. typedef struct ControlDefSpec            ControlDefSpec;
  790. EXTERN_API( OSStatus )
  791. CreateCustomControl                (WindowRef                 owningWindow,
  792.                                  const Rect *            contBounds,
  793.                                  const ControlDefSpec *    def,
  794.                                  Collection             initData,
  795.                                  ControlRef *            outControl);
  796.  
  797. EXTERN_API( ControlRef )
  798. NewControl                        (WindowPtr                 owningWindow,
  799.                                  const Rect *            boundsRect,
  800.                                  ConstStr255Param         controlTitle,
  801.                                  Boolean                 initiallyVisible,
  802.                                  SInt16                 initialValue,
  803.                                  SInt16                 minimumValue,
  804.                                  SInt16                 maximumValue,
  805.                                  SInt16                 procID,
  806.                                  SInt32                 controlReference)                    ONEWORDINLINE(0xA954);
  807.  
  808. EXTERN_API( ControlRef )
  809. GetNewControl                    (SInt16                 resourceID,
  810.                                  WindowPtr                 owningWindow)                        ONEWORDINLINE(0xA9BE);
  811.  
  812. EXTERN_API( void )
  813. DisposeControl                    (ControlRef             theControl)                            ONEWORDINLINE(0xA955);
  814.  
  815. EXTERN_API( void )
  816. KillControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA956);
  817.  
  818. EXTERN_API( OSStatus )
  819. FlattenControl                    (ControlRef             control,
  820.                                  Boolean                 flattenSubControls,
  821.                                  Collection             collection);
  822.  
  823. EXTERN_API( OSStatus )
  824. UnflattenControl                (WindowRef                 window,
  825.                                  Collection             collection,
  826.                                  ControlRef *            outControl);
  827.  
  828. /*--------------------------------------------------------------------------------------*/
  829. /*    o Control Definition Registration                                                    */
  830. /*--------------------------------------------------------------------------------------*/
  831. /*    In GetNewControl on Carbon, the Control Manager needs to know how to map the procID    */
  832. /*    to a ControlDefSpec. With RegisterControlDefinition, your application can inform    */
  833. /*    the Control Manager which ControlDefSpec to call when it sees a request to use a    */
  834. /*    'CDEF' of a particular resource ID.                                                    */
  835. /*                                                                                        */
  836. /*    Since custom control definitions receive their initialization data in a Collection,    */
  837. /*    you must also provide a procedure to convert the bounds, min, max, and other fields    */
  838. /*    from the 'CNTL' resource into a Collection. If you don't provide a conversion proc,    */
  839. /*    your control will receive an empty collection when it is sent the initialization    */
  840. /*    message.                                                                                */
  841. /*    If you want the value, min, visibility, etc. to be given to the control, you must    */
  842. /*    add the appropriate tagged data to the collection. See the Control Collection Tags    */
  843. /*    above.                                                                                */
  844. /*    RegisterControlDefinition is only available as part of Carbon                        */
  845. typedef CALLBACK_API( OSStatus , ControlCNTLToCollectionProcPtr )(const Rect *bounds, SInt16 value, Boolean visible, SInt16 max, SInt16 min, SInt16 procID, SInt32 refCon, ConstStr255Param title, Collection collection);
  846. typedef STACK_UPP_TYPE(ControlCNTLToCollectionProcPtr)             ControlCNTLToCollectionUPP;
  847. #if OPAQUE_UPP_TYPES
  848.     EXTERN_API(ControlCNTLToCollectionUPP)
  849.     NewControlCNTLToCollectionUPP    (ControlCNTLToCollectionProcPtr userRoutine);
  850.  
  851.     EXTERN_API(void)
  852.     DisposeControlCNTLToCollectionUPP    (ControlCNTLToCollectionUPP userUPP);
  853.  
  854.     EXTERN_API(OSStatus)
  855.     InvokeControlCNTLToCollectionUPP    (const Rect *        bounds,
  856.                                     SInt16                    value,
  857.                                     Boolean                    visible,
  858.                                     SInt16                    max,
  859.                                     SInt16                    min,
  860.                                     SInt16                    procID,
  861.                                     SInt32                    refCon,
  862.                                     ConstStr255Param        title,
  863.                                     Collection                collection,
  864.                                     ControlCNTLToCollectionUPP userUPP);
  865.  
  866. #else
  867.     enum { uppControlCNTLToCollectionProcInfo = 0x00FEA6F0 };         /* pascal 4_bytes Func(4_bytes, 2_bytes, 1_byte, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  868.     #define NewControlCNTLToCollectionUPP(userRoutine)                 (ControlCNTLToCollectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlCNTLToCollectionProcInfo, GetCurrentArchitecture())
  869.     #define DisposeControlCNTLToCollectionUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  870.     #define InvokeControlCNTLToCollectionUPP(bounds, value, visible, max, min, procID, refCon, title, collection, userUPP)  (OSStatus)CALL_NINE_PARAMETER_UPP((userUPP), uppControlCNTLToCollectionProcInfo, (bounds), (value), (visible), (max), (min), (procID), (refCon), (title), (collection))
  871. #endif
  872. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  873. #define NewControlCNTLToCollectionProc(userRoutine)             NewControlCNTLToCollectionUPP(userRoutine)
  874. #define CallControlCNTLToCollectionProc(userRoutine, bounds, value, visible, max, min, procID, refCon, title, collection) InvokeControlCNTLToCollectionUPP(bounds, value, visible, max, min, procID, refCon, title, collection, userRoutine)
  875. EXTERN_API( OSStatus )
  876. RegisterControlDefinition        (SInt16                 CDEFResID,
  877.                                  const ControlDefSpec *    def,
  878.                                  ControlCNTLToCollectionUPP  conversionProc);
  879.  
  880.  
  881.  
  882. /*--------------------------------------------------------------------------------------*/
  883. /*    o Control Visible State                                                                */
  884. /*--------------------------------------------------------------------------------------*/
  885. EXTERN_API( void )
  886. HiliteControl                    (ControlRef             theControl,
  887.                                  ControlPartCode         hiliteState)                        ONEWORDINLINE(0xA95D);
  888.  
  889. EXTERN_API( void )
  890. ShowControl                        (ControlRef             theControl)                            ONEWORDINLINE(0xA957);
  891.  
  892. EXTERN_API( void )
  893. HideControl                        (ControlRef             theControl)                            ONEWORDINLINE(0xA958);
  894.  
  895.  
  896. /* following state routines available only with Appearance 1.0 and later*/
  897. EXTERN_API( Boolean )
  898. IsControlActive                    (ControlRef             inControl)                            THREEWORDINLINE(0x303C, 0x0005, 0xAA73);
  899.  
  900. EXTERN_API( Boolean )
  901. IsControlVisible                (ControlRef             inControl)                            THREEWORDINLINE(0x303C, 0x0006, 0xAA73);
  902.  
  903. EXTERN_API( OSErr )
  904. ActivateControl                    (ControlRef             inControl)                            THREEWORDINLINE(0x303C, 0x0007, 0xAA73);
  905.  
  906. EXTERN_API( OSErr )
  907. DeactivateControl                (ControlRef             inControl)                            THREEWORDINLINE(0x303C, 0x0008, 0xAA73);
  908.  
  909. EXTERN_API( OSErr )
  910. SetControlVisibility            (ControlRef             inControl,
  911.                                  Boolean                 inIsVisible,
  912.                                  Boolean                 inDoDraw)                            THREEWORDINLINE(0x303C, 0x001E, 0xAA73);
  913.  
  914.  
  915. /*--------------------------------------------------------------------------------------*/
  916. /*    o Control Imaging                                                                    */
  917. /*--------------------------------------------------------------------------------------*/
  918. EXTERN_API( void )
  919. DrawControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA969);
  920.  
  921. EXTERN_API( void )
  922. Draw1Control                    (ControlRef             theControl)                            ONEWORDINLINE(0xA96D);
  923.  
  924. #define DrawOneControl(theControl) Draw1Control(theControl)
  925.  
  926. EXTERN_API( void )
  927. UpdateControls                    (WindowPtr                 theWindow,
  928.                                  RgnHandle                 updateRegion)                        ONEWORDINLINE(0xA953);
  929.  
  930.  
  931. /* following imaging routines available only with Appearance 1.0 and later*/
  932. EXTERN_API( OSErr )
  933. GetBestControlRect                (ControlRef             inControl,
  934.                                  Rect *                    outRect,
  935.                                  SInt16 *                outBaseLineOffset)                    THREEWORDINLINE(0x303C, 0x001B, 0xAA73);
  936.  
  937. EXTERN_API( OSErr )
  938. SetControlFontStyle                (ControlRef             inControl,
  939.                                  const ControlFontStyleRec * inStyle)                        THREEWORDINLINE(0x303C, 0x001C, 0xAA73);
  940.  
  941. EXTERN_API( void )
  942. DrawControlInCurrentPort        (ControlRef             inControl)                            THREEWORDINLINE(0x303C, 0x0018, 0xAA73);
  943.  
  944. EXTERN_API( OSErr )
  945. SetUpControlBackground            (ControlRef             inControl,
  946.                                  SInt16                 inDepth,
  947.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x001D, 0xAA73);
  948.  
  949. /* SetUpControlTextColor is available in Appearance 1.1 or later.*/
  950. EXTERN_API( OSErr )
  951. SetUpControlTextColor            (ControlRef             inControl,
  952.                                  SInt16                 inDepth,
  953.                                  Boolean                 inIsColorDevice);
  954.  
  955.  
  956. /*--------------------------------------------------------------------------------------*/
  957. /*    o Control Mousing                                                                    */
  958. /*--------------------------------------------------------------------------------------*/
  959. /*
  960.     NOTE ON CONTROL ACTION PROCS
  961.  
  962.     When using the TrackControl() call when tracking an indicator, the actionProc parameter
  963.     (type ControlActionUPP) should be replaced by a parameter of type DragGrayRgnUPP
  964.     (see Quickdraw.h).
  965.  
  966.     If, however, you are using the live feedback variants of scroll bars or sliders, you
  967.     can pass a ControlActionUPP in when tracking the indicator as well. This functionality
  968.     is available in Appearance 1.0 or later.
  969. */
  970. EXTERN_API( ControlPartCode )
  971. TrackControl                    (ControlRef             theControl,
  972.                                  Point                     startPoint,
  973.                                  ControlActionUPP         actionProc) /* can be NULL */        ONEWORDINLINE(0xA968);
  974.  
  975. EXTERN_API( void )
  976. DragControl                        (ControlRef             theControl,
  977.                                  Point                     startPoint,
  978.                                  const Rect *            limitRect,
  979.                                  const Rect *            slopRect,
  980.                                  DragConstraint         axis)                                ONEWORDINLINE(0xA967);
  981.  
  982. EXTERN_API( ControlPartCode )
  983. TestControl                        (ControlRef             theControl,
  984.                                  Point                     testPoint)                            ONEWORDINLINE(0xA966);
  985.  
  986. EXTERN_API( ControlPartCode )
  987. FindControl                        (Point                     testPoint,
  988.                                  WindowPtr                 theWindow,
  989.                                  ControlRef *            theControl)                            ONEWORDINLINE(0xA96C);
  990.  
  991. /* The following mousing routines available only with Appearance 1.0 and later    */
  992. /*                                                                                */
  993. /* HandleControlClick is preferable to TrackControl when running under            */
  994. /* Appearance 1.0 as you can pass in modifiers, which some of the new controls    */
  995. /* use, such as edit text and list boxes.                                        */
  996. EXTERN_API( ControlRef )
  997. FindControlUnderMouse            (Point                     inWhere,
  998.                                  WindowPtr                 inWindow,
  999.                                  SInt16 *                outPart)                            THREEWORDINLINE(0x303C, 0x0009, 0xAA73);
  1000.  
  1001. EXTERN_API( ControlPartCode )
  1002. HandleControlClick                (ControlRef             inControl,
  1003.                                  Point                     inWhere,
  1004.                                  EventModifiers         inModifiers,
  1005.                                  ControlActionUPP         inAction) /* can be NULL */            THREEWORDINLINE(0x303C, 0x000A, 0xAA73);
  1006.  
  1007. /* Contextual Menu support in the Control Manager is only available on Carbon.    */
  1008. /* If the control didn't display a contextual menu (possibly because the point    */
  1009. /* was in a    non-interesting part), the menuDisplayed output parameter will be    */
  1010. /* false. If the control did display a menu, menuDisplayed will be true.        */
  1011. /* This in on Carbon only                                                        */
  1012. EXTERN_API( OSStatus )
  1013. HandleControlContextualMenuClick (ControlRef             inControl,
  1014.                                  Point                     inWhere,
  1015.                                  Boolean *                menuDisplayed);
  1016.  
  1017. /* Some complex controls (like Data Browser) require proper sequencing of        */
  1018. /* window activation and click processing. In some cases, the control might        */
  1019. /* want the window to be left inactive yet still handle the click, or vice-        */
  1020. /* versa. The GetControlClickActivation routine lets a control client ask the    */
  1021. /* control how it wishes to behave for a particular click.                        */
  1022. /* This in on Carbon only.                                                        */
  1023. EXTERN_API( OSStatus )
  1024. GetControlClickActivation        (ControlRef             inControl,
  1025.                                  Point                     inWhere,
  1026.                                  EventModifiers         inModifiers,
  1027.                                  ClickActivationResult * outResult);
  1028.  
  1029.  
  1030. /*--------------------------------------------------------------------------------------*/
  1031. /*    o Control Events (available only with Appearance 1.0 and later)                        */
  1032. /*--------------------------------------------------------------------------------------*/
  1033. EXTERN_API( SInt16 )
  1034. HandleControlKey                (ControlRef             inControl,
  1035.                                  SInt16                 inKeyCode,
  1036.                                  SInt16                 inCharCode,
  1037.                                  EventModifiers         inModifiers)                        THREEWORDINLINE(0x303C, 0x000B, 0xAA73);
  1038.  
  1039. EXTERN_API( void )
  1040. IdleControls                    (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000C, 0xAA73);
  1041.  
  1042.  
  1043.  
  1044. /*--------------------------------------------------------------------------------------*/
  1045. /* o Control Mouse Tracking (available with Carbon)                                        */
  1046. /*--------------------------------------------------------------------------------------*/
  1047. /* The HandleControlSetCursor routine requests that a given control set the cursor to    */
  1048. /* something appropriate based on the mouse location.                                    */
  1049. /* If the control didn't want to set the cursor (because the point was in a                */
  1050. /* non-interesting part), the cursorWasSet output parameter will be false. If the        */
  1051. /* control did set the cursor, cursorWasSet will be true.                                */
  1052. /* Carbon only.                                                                            */
  1053. EXTERN_API( OSStatus )
  1054. HandleControlSetCursor            (ControlRef             control,
  1055.                                  Point                     localPoint,
  1056.                                  EventModifiers         modifiers,
  1057.                                  Boolean *                cursorWasSet);
  1058.  
  1059. /*--------------------------------------------------------------------------------------*/
  1060. /*    o Control Positioning                                                                */
  1061. /*--------------------------------------------------------------------------------------*/
  1062. EXTERN_API( void )
  1063. MoveControl                        (ControlRef             theControl,
  1064.                                  SInt16                 h,
  1065.                                  SInt16                 v)                                    ONEWORDINLINE(0xA959);
  1066.  
  1067. EXTERN_API( void )
  1068. SizeControl                        (ControlRef             theControl,
  1069.                                  SInt16                 w,
  1070.                                  SInt16                 h)                                    ONEWORDINLINE(0xA95C);
  1071.  
  1072. /*--------------------------------------------------------------------------------------*/
  1073. /*    o Control Title                                                                        */
  1074. /*--------------------------------------------------------------------------------------*/
  1075. EXTERN_API( void )
  1076. SetControlTitle                    (ControlRef             theControl,
  1077.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA95F);
  1078.  
  1079. EXTERN_API( void )
  1080. GetControlTitle                    (ControlRef             theControl,
  1081.                                  Str255                 title)                                ONEWORDINLINE(0xA95E);
  1082.  
  1083. /*--------------------------------------------------------------------------------------*/
  1084. /*    o Control Value                                                                        */
  1085. /*--------------------------------------------------------------------------------------*/
  1086. EXTERN_API( SInt16 )
  1087. GetControlValue                    (ControlRef             theControl)                            ONEWORDINLINE(0xA960);
  1088.  
  1089. EXTERN_API( void )
  1090. SetControlValue                    (ControlRef             theControl,
  1091.                                  SInt16                 newValue)                            ONEWORDINLINE(0xA963);
  1092.  
  1093. EXTERN_API( SInt16 )
  1094. GetControlMinimum                (ControlRef             theControl)                            ONEWORDINLINE(0xA961);
  1095.  
  1096. EXTERN_API( void )
  1097. SetControlMinimum                (ControlRef             theControl,
  1098.                                  SInt16                 newMinimum)                            ONEWORDINLINE(0xA964);
  1099.  
  1100. EXTERN_API( SInt16 )
  1101. GetControlMaximum                (ControlRef             theControl)                            ONEWORDINLINE(0xA962);
  1102.  
  1103. EXTERN_API( void )
  1104. SetControlMaximum                (ControlRef             theControl,
  1105.                                  SInt16                 newMaximum)                            ONEWORDINLINE(0xA965);
  1106.  
  1107.  
  1108. /* proportional scrolling/32-bit value support is new with Appearance 1.1*/
  1109.  
  1110. EXTERN_API( SInt32 )
  1111. GetControlViewSize                (ControlRef             theControl);
  1112.  
  1113. EXTERN_API( void )
  1114. SetControlViewSize                (ControlRef             theControl,
  1115.                                  SInt32                 newViewSize);
  1116.  
  1117. EXTERN_API( SInt32 )
  1118. GetControl32BitValue            (ControlRef             theControl);
  1119.  
  1120. EXTERN_API( void )
  1121. SetControl32BitValue            (ControlRef             theControl,
  1122.                                  SInt32                 newValue);
  1123.  
  1124. EXTERN_API( SInt32 )
  1125. GetControl32BitMaximum            (ControlRef             theControl);
  1126.  
  1127. EXTERN_API( void )
  1128. SetControl32BitMaximum            (ControlRef             theControl,
  1129.                                  SInt32                 newMaximum);
  1130.  
  1131. EXTERN_API( SInt32 )
  1132. GetControl32BitMinimum            (ControlRef             theControl);
  1133.  
  1134. EXTERN_API( void )
  1135. SetControl32BitMinimum            (ControlRef             theControl,
  1136.                                  SInt32                 newMinimum);
  1137.  
  1138. /*
  1139.        IsValidControlHandle will tell you if the handle you pass in belongs to a control
  1140.       the Control Manager knows about. It does not sanity check the data in the control.
  1141. */
  1142.  
  1143. EXTERN_API( Boolean )
  1144. IsValidControlHandle            (ControlRef             theControl);
  1145.  
  1146. /*--------------------------------------------------------------------------------------*/
  1147. /* o Control IDs                                                                        */
  1148. /* Carbon only.                                                                            */
  1149. /*--------------------------------------------------------------------------------------*/
  1150.  
  1151. struct ControlID {
  1152.     OSType                             signature;
  1153.     SInt32                             id;
  1154. };
  1155. typedef struct ControlID                ControlID;
  1156. EXTERN_API( OSStatus )
  1157. SetControlID                    (ControlRef             inControl,
  1158.                                  const ControlID *        inID);
  1159.  
  1160. EXTERN_API( OSStatus )
  1161. GetControlID                    (ControlRef             inControl,
  1162.                                  ControlID *            outID);
  1163.  
  1164. EXTERN_API( OSStatus )
  1165. GetControlByID                    (WindowRef                 inWindow,
  1166.                                  const ControlID *        inID,
  1167.                                  ControlRef *            outControl);
  1168.  
  1169. /*--------------------------------------------------------------------------------------*/
  1170. /* o Properties                                                                            */
  1171. /*--------------------------------------------------------------------------------------*/
  1172. enum {
  1173.     kControlPropertyPersistent    = 0x00000001                    /* whether this property gets saved when flattening the control*/
  1174. };
  1175.  
  1176. EXTERN_API( OSStatus )
  1177. GetControlProperty                (ControlRef             control,
  1178.                                  OSType                 propertyCreator,
  1179.                                  OSType                 propertyTag,
  1180.                                  UInt32                 bufferSize,
  1181.                                  UInt32 *                actualSize,
  1182.                                  void *                    propertyBuffer);
  1183.  
  1184. EXTERN_API( OSStatus )
  1185. GetControlPropertySize            (ControlRef             control,
  1186.                                  OSType                 propertyCreator,
  1187.                                  OSType                 propertyTag,
  1188.                                  UInt32 *                size);
  1189.  
  1190. EXTERN_API( OSStatus )
  1191. SetControlProperty                (ControlRef             control,
  1192.                                  OSType                 propertyCreator,
  1193.                                  OSType                 propertyTag,
  1194.                                  UInt32                 propertySize,
  1195.                                  void *                    propertyData);
  1196.  
  1197. EXTERN_API( OSStatus )
  1198. RemoveControlProperty            (ControlRef             control,
  1199.                                  OSType                 propertyCreator,
  1200.                                  OSType                 propertyTag);
  1201.  
  1202. EXTERN_API( OSStatus )
  1203. GetControlPropertyAttributes    (ControlRef             control,
  1204.                                  OSType                 propertyCreator,
  1205.                                  OSType                 propertyTag,
  1206.                                  UInt32 *                attributes);
  1207.  
  1208. EXTERN_API( OSStatus )
  1209. ChangeControlPropertyAttributes    (ControlRef             control,
  1210.                                  OSType                 propertyCreator,
  1211.                                  OSType                 propertyTag,
  1212.                                  UInt32                 attributesToSet,
  1213.                                  UInt32                 attributesToClear);
  1214.  
  1215. /*--------------------------------------------------------------------------------------*/
  1216. /*    o Control Regions (Appearance 1.1 or later)                                            */
  1217. /*                                                                                        */
  1218. /*    See the discussion on meta-parts in this header for more information                */
  1219. /*--------------------------------------------------------------------------------------*/
  1220. EXTERN_API( OSStatus )
  1221. GetControlRegion                (ControlRef             inControl,
  1222.                                  ControlPartCode         inPart,
  1223.                                  RgnHandle                 outRegion);
  1224.  
  1225.  
  1226.  
  1227. /*--------------------------------------------------------------------------------------*/
  1228. /*    o Control Variant                                                                    */
  1229. /*--------------------------------------------------------------------------------------*/
  1230. EXTERN_API( ControlVariant )
  1231. GetControlVariant                (ControlRef             theControl)                            ONEWORDINLINE(0xA809);
  1232.  
  1233. /*--------------------------------------------------------------------------------------*/
  1234. /*    o Control Action                                                                    */
  1235. /*--------------------------------------------------------------------------------------*/
  1236. EXTERN_API( void )
  1237. SetControlAction                (ControlRef             theControl,
  1238.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA96B);
  1239.  
  1240. EXTERN_API( ControlActionUPP )
  1241. GetControlAction                (ControlRef             theControl)                            ONEWORDINLINE(0xA96A);
  1242.  
  1243. /*--------------------------------------------------------------------------------------*/
  1244. /* o Control Accessors                                                                    */
  1245. /*--------------------------------------------------------------------------------------*/
  1246. EXTERN_API( void )
  1247. SetControlReference                (ControlRef             theControl,
  1248.                                  SInt32                 data)                                ONEWORDINLINE(0xA95B);
  1249.  
  1250. EXTERN_API( SInt32 )
  1251. GetControlReference                (ControlRef             theControl)                            ONEWORDINLINE(0xA95A);
  1252.  
  1253. #if !OPAQUE_TOOLBOX_STRUCTS
  1254. EXTERN_API( Boolean )
  1255. GetAuxiliaryControlRecord        (ControlRef             theControl,
  1256.                                  AuxCtlHandle *            acHndl)                                ONEWORDINLINE(0xAA44);
  1257.  
  1258. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  1259.  
  1260. EXTERN_API( void )
  1261. SetControlColor                    (ControlRef             theControl,
  1262.                                  CCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA43);
  1263.  
  1264. /*--------------------------------------------------------------------------------------*/
  1265. /*    o Control Hierarchy (Appearance 1.0 and later only)                                    */
  1266. /*--------------------------------------------------------------------------------------*/
  1267. EXTERN_API( SInt32 )
  1268. SendControlMessage                (ControlRef             inControl,
  1269.                                  SInt16                 inMessage,
  1270.                                  SInt32                 inParam)                            THREEWORDINLINE(0x303C, 0xFFFE, 0xAA73);
  1271.  
  1272. EXTERN_API( OSErr )
  1273. DumpControlHierarchy            (WindowPtr                 inWindow,
  1274.                                  const FSSpec *            inDumpFile)                            THREEWORDINLINE(0x303C, 0xFFFF, 0xAA73);
  1275.  
  1276. EXTERN_API( OSErr )
  1277. CreateRootControl                (WindowPtr                 inWindow,
  1278.                                  ControlRef *            outControl)                            THREEWORDINLINE(0x303C, 0x0001, 0xAA73);
  1279.  
  1280. EXTERN_API( OSErr )
  1281. GetRootControl                    (WindowPtr                 inWindow,
  1282.                                  ControlRef *            outControl)                            THREEWORDINLINE(0x303C, 0x0002, 0xAA73);
  1283.  
  1284. EXTERN_API( OSErr )
  1285. EmbedControl                    (ControlRef             inControl,
  1286.                                  ControlRef             inContainer)                        THREEWORDINLINE(0x303C, 0x0003, 0xAA73);
  1287.  
  1288. EXTERN_API( OSErr )
  1289. AutoEmbedControl                (ControlRef             inControl,
  1290.                                  WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0004, 0xAA73);
  1291.  
  1292. EXTERN_API( OSErr )
  1293. GetSuperControl                    (ControlRef             inControl,
  1294.                                  ControlRef *            outParent)                            THREEWORDINLINE(0x303C, 0x0015, 0xAA73);
  1295.  
  1296. EXTERN_API( OSErr )
  1297. CountSubControls                (ControlRef             inControl,
  1298.                                  UInt16 *                outNumChildren)                        THREEWORDINLINE(0x303C, 0x0016, 0xAA73);
  1299.  
  1300. EXTERN_API( OSErr )
  1301. GetIndexedSubControl            (ControlRef             inControl,
  1302.                                  UInt16                 inIndex,
  1303.                                  ControlRef *            outSubControl)                        THREEWORDINLINE(0x303C, 0x0017, 0xAA73);
  1304.  
  1305. EXTERN_API( OSErr )
  1306. SetControlSupervisor            (ControlRef             inControl,
  1307.                                  ControlRef             inBoss)                                THREEWORDINLINE(0x303C, 0x001A, 0xAA73);
  1308.  
  1309.  
  1310.  
  1311. /*--------------------------------------------------------------------------------------*/
  1312. /*    o Keyboard Focus (available only with Appearance 1.0 and later)                        */
  1313. /*--------------------------------------------------------------------------------------*/
  1314. EXTERN_API( OSErr )
  1315. GetKeyboardFocus                (WindowPtr                 inWindow,
  1316.                                  ControlRef *            outControl)                            THREEWORDINLINE(0x303C, 0x000D, 0xAA73);
  1317.  
  1318. EXTERN_API( OSErr )
  1319. SetKeyboardFocus                (WindowPtr                 inWindow,
  1320.                                  ControlRef             inControl,
  1321.                                  ControlFocusPart         inPart)                                THREEWORDINLINE(0x303C, 0x000E, 0xAA73);
  1322.  
  1323. EXTERN_API( OSErr )
  1324. AdvanceKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000F, 0xAA73);
  1325.  
  1326. EXTERN_API( OSErr )
  1327. ReverseKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0010, 0xAA73);
  1328.  
  1329. EXTERN_API( OSErr )
  1330. ClearKeyboardFocus                (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0019, 0xAA73);
  1331.  
  1332.  
  1333.  
  1334. /*--------------------------------------------------------------------------------------*/
  1335. /*    o Control Data (available only with Appearance 1.0 and later)                        */
  1336. /*--------------------------------------------------------------------------------------*/
  1337.  
  1338. EXTERN_API( OSErr )
  1339. GetControlFeatures                (ControlRef             inControl,
  1340.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0011, 0xAA73);
  1341.  
  1342. EXTERN_API( OSErr )
  1343. SetControlData                    (ControlRef             inControl,
  1344.                                  ControlPartCode         inPart,
  1345.                                  ResType                 inTagName,
  1346.                                  Size                     inSize,
  1347.                                  void *                    inData)                                THREEWORDINLINE(0x303C, 0x0012, 0xAA73);
  1348.  
  1349. EXTERN_API( OSErr )
  1350. GetControlData                    (ControlRef             inControl,
  1351.                                  ControlPartCode         inPart,
  1352.                                  ResType                 inTagName,
  1353.                                  Size                     inBufferSize,
  1354.                                  void *                    inBuffer,
  1355.                                  Size *                    outActualSize)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA73);
  1356.  
  1357. EXTERN_API( OSErr )
  1358. GetControlDataSize                (ControlRef             inControl,
  1359.                                  ControlPartCode         inPart,
  1360.                                  ResType                 inTagName,
  1361.                                  Size *                    outMaxSize)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA73);
  1362.  
  1363.  
  1364. /*--------------------------------------------------------------------------------------*/
  1365. /*    o Control Drag & Drop                                                                */
  1366. /*        Carbon only.                                                                    */
  1367. /*--------------------------------------------------------------------------------------*/
  1368. /* some simple redefinitions of the messages found in the Drag header*/
  1369. enum {
  1370.     kDragTrackingEnterControl    = kDragTrackingEnterWindow,
  1371.     kDragTrackingInControl        = kDragTrackingInWindow,
  1372.     kDragTrackingLeaveControl    = kDragTrackingLeaveWindow
  1373. };
  1374.  
  1375. EXTERN_API( OSStatus )
  1376. HandleControlDragTracking        (ControlRef             inControl,
  1377.                                  DragTrackingMessage     inMessage,
  1378.                                  DragReference             inDrag,
  1379.                                  Boolean *                outLikesDrag);
  1380.  
  1381. EXTERN_API( OSStatus )
  1382. HandleControlDragReceive        (ControlRef             inControl,
  1383.                                  DragReference             inDrag);
  1384.  
  1385. EXTERN_API( OSStatus )
  1386. SetControlDragTrackingEnabled    (ControlRef             theControl,
  1387.                                  Boolean                 tracks);
  1388.  
  1389. EXTERN_API( OSStatus )
  1390. IsControlDragTrackingEnabled    (ControlRef             theControl,
  1391.                                  Boolean *                tracks);
  1392.  
  1393. EXTERN_API( OSStatus )
  1394. SetAutomaticControlDragTrackingEnabledForWindow (WindowPtr  theWindow,
  1395.                                  Boolean                 tracks);
  1396.  
  1397. EXTERN_API( OSStatus )
  1398. IsAutomaticControlDragTrackingEnabledForWindow (WindowPtr  theWindow,
  1399.                                  Boolean *                tracks);
  1400.  
  1401.  
  1402. #if !TARGET_OS_MAC
  1403. /*--------------------------------------------------------------------------------------*/
  1404. /*    o QuickTime 3.0 Win32/unix notification    mechanism                                    */
  1405. /*--------------------------------------------------------------------------------------*/
  1406. /* Proc used to notify window that something happened to the control*/
  1407. typedef CALLBACK_API_C( void , ControlNotificationProcPtr )(WindowPtr theWindow, ControlRef theControl, ControlNotification notification, long param1, long param2);
  1408. /*
  1409.    Proc used to prefilter events before handled by control.  A client of a control calls
  1410.    CTRLSetPreFilterProc() to have the control call this proc before handling the event.
  1411.    If the proc returns TRUE, the control can go ahead and handle the event.
  1412. */
  1413. typedef CALLBACK_API_C( Boolean , PreFilterEventProc )(ControlRef theControl, EventRecord *theEvent);
  1414. EXTERN_API_C( long )
  1415. GetControlComponentInstance        (ControlRef             theControl);
  1416.  
  1417. EXTERN_API_C( ControlRef )
  1418. GetControlHandleFromCookie        (long                     cookie);
  1419.  
  1420. EXTERN_API_C( void )
  1421. SetControlDefProc                (short                     resID,
  1422.                                  ControlDefProcPtr         proc);
  1423.  
  1424.  
  1425. typedef ControlNotificationProcPtr         ControlNotificationUPP;
  1426. #endif  /* !TARGET_OS_MAC */
  1427.  
  1428. /*--------------------------------------------------------------------------------------*/
  1429. /*    o C Glue                                                                            */
  1430. /*--------------------------------------------------------------------------------------*/
  1431. #if CALL_NOT_IN_CARBON
  1432. EXTERN_API_C( void )
  1433. dragcontrol                        (ControlRef             theControl,
  1434.                                  Point *                startPt,
  1435.                                  const Rect *            limitRect,
  1436.                                  const Rect *            slopRect,
  1437.                                  short                     axis);
  1438.  
  1439. EXTERN_API_C( ControlRef )
  1440. newcontrol                        (WindowPtr                 theWindow,
  1441.                                  const Rect *            boundsRect,
  1442.                                  const char *            title,
  1443.                                  Boolean                 visible,
  1444.                                  short                     value,
  1445.                                  short                     min,
  1446.                                  short                     max,
  1447.                                  short                     procID,
  1448.                                  long                     refCon);
  1449.  
  1450. EXTERN_API_C( short )
  1451. findcontrol                        (Point *                thePoint,
  1452.                                  WindowPtr                 theWindow,
  1453.                                  ControlRef *            theControl);
  1454.  
  1455. EXTERN_API_C( void )
  1456. getcontroltitle                    (ControlRef             theControl,
  1457.                                  char *                    title);
  1458.  
  1459. EXTERN_API_C( void )
  1460. setcontroltitle                    (ControlRef             theControl,
  1461.                                  const char *            title);
  1462.  
  1463. EXTERN_API_C( short )
  1464. trackcontrol                    (ControlRef             theControl,
  1465.                                  Point *                thePoint,
  1466.                                  ControlActionUPP         actionProc);
  1467.  
  1468. EXTERN_API_C( short )
  1469. testcontrol                        (ControlRef             theControl,
  1470.                                  Point *                thePt);
  1471.  
  1472. #endif  /* CALL_NOT_IN_CARBON */
  1473.  
  1474. #if OLDROUTINENAMES
  1475. /*--------------------------------------------------------------------------------------*/
  1476. /*    o OLDROUTINENAMES                                                                    */
  1477. /*--------------------------------------------------------------------------------------*/
  1478. enum {
  1479.     useWFont                    = kControlUsesOwningWindowsFontVariant
  1480. };
  1481.  
  1482. enum {
  1483.     inThumb                        = kControlIndicatorPart,
  1484.     kNoHiliteControlPart        = kControlNoPart,
  1485.     kInIndicatorControlPart        = kControlIndicatorPart,
  1486.     kReservedControlPart        = kControlDisabledPart,
  1487.     kControlInactiveControlPart    = kControlInactivePart
  1488. };
  1489.  
  1490.  
  1491. #define SetCTitle(theControl, title) SetControlTitle(theControl, title)
  1492. #define GetCTitle(theControl, title) GetControlTitle(theControl, title)
  1493. #define UpdtControl(theWindow, updateRgn) UpdateControls(theWindow, updateRgn)
  1494. #define SetCtlValue(theControl, theValue) SetControlValue(theControl, theValue)
  1495. #define GetCtlValue(theControl) GetControlValue(theControl)
  1496. #define SetCtlMin(theControl, minValue) SetControlMinimum(theControl, minValue)
  1497. #define GetCtlMin(theControl) GetControlMinimum(theControl)
  1498. #define SetCtlMax(theControl, maxValue) SetControlMaximum(theControl, maxValue)
  1499. #define GetCtlMax(theControl) GetControlMaximum(theControl)
  1500. #define GetAuxCtl(theControl, acHndl) GetAuxiliaryControlRecord(theControl, acHndl)
  1501. #define SetCRefCon(theControl, data) SetControlReference(theControl, data)
  1502. #define GetCRefCon(theControl) GetControlReference(theControl)
  1503. #define SetCtlAction(theControl, actionProc) SetControlAction(theControl, actionProc)
  1504. #define GetCtlAction(theControl) GetControlAction(theControl)
  1505. #define SetCtlColor(theControl, newColorTable) SetControlColor(theControl, newColorTable)
  1506. #define GetCVariant(theControl) GetControlVariant(theControl)
  1507. #define getctitle(theControl, title) getcontroltitle(theControl, title)
  1508. #define setctitle(theControl, title) setcontroltitle(theControl, title)
  1509. #endif  /* OLDROUTINENAMES */
  1510.  
  1511. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  1512. /* Getters */
  1513. EXTERN_API( Rect *)
  1514. GetControlBounds                (ControlRef             control,
  1515.                                  Rect *                    bounds);
  1516.  
  1517. EXTERN_API( Boolean )
  1518. IsControlHilited                (ControlRef             control);
  1519.  
  1520. EXTERN_API( UInt16 )
  1521. GetControlHilite                (ControlRef             control);
  1522.  
  1523. EXTERN_API( WindowPtr )
  1524. GetControlOwner                    (ControlRef             control);
  1525.  
  1526. EXTERN_API( Handle )
  1527. GetControlDataHandle            (ControlRef             control);
  1528.  
  1529. EXTERN_API( MenuHandle )
  1530. GetControlPopupMenuHandle        (ControlRef             control);
  1531.  
  1532. EXTERN_API( short )
  1533. GetControlPopupMenuID            (ControlRef             control);
  1534.  
  1535. /* Setters */
  1536. EXTERN_API( void )
  1537. SetControlDataHandle            (ControlRef             control,
  1538.                                  Handle                 dataHandle);
  1539.  
  1540. EXTERN_API( void )
  1541. SetControlBounds                (ControlRef             control,
  1542.                                  const Rect *            bounds);
  1543.  
  1544. EXTERN_API( void )
  1545. SetControlPopupMenuHandle        (ControlRef             control,
  1546.                                  MenuHandle             popupMenu);
  1547.  
  1548. EXTERN_API( void )
  1549. SetControlPopupMenuID            (ControlRef             control,
  1550.                                  short                     menuID);
  1551.  
  1552. #endif  /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  1553.  
  1554. #if !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS
  1555. #define GetControlListFromWindow(theWindow)        ( *(ControlRef *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  1556. #define GetControlOwningWindowControlList(theWindow)        ( *(ControlRef *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  1557. #endif  /* !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */
  1558.  
  1559.  
  1560.  
  1561. #if PRAGMA_STRUCT_ALIGN
  1562.     #pragma options align=reset
  1563. #elif PRAGMA_STRUCT_PACKPUSH
  1564.     #pragma pack(pop)
  1565. #elif PRAGMA_STRUCT_PACK
  1566.     #pragma pack()
  1567. #endif
  1568.  
  1569. #ifdef PRAGMA_IMPORT_OFF
  1570. #pragma import off
  1571. #elif PRAGMA_IMPORT
  1572. #pragma import reset
  1573. #endif
  1574.  
  1575. #ifdef __cplusplus
  1576. }
  1577. #endif
  1578.  
  1579. #endif /* __CONTROLS__ */
  1580.  
  1581.